package com.atguigui.leetcode1;

import java.util.Arrays;

/**
 * 1637.两点之间不包含任何点的最宽垂直区域
 * Project: leetcode
 * Package: com.atguigui.leetcode1
 * Version: 1.0
 * <p>
 * Created by WJX on 2023/3/30 8:53
 */
public class P1637WidestVerticalAreaBetweenTwoPointsContainingNoPoints {
    public static void main(String[] args) {
        Solution solution = new P1637WidestVerticalAreaBetweenTwoPointsContainingNoPoints().new Solution();
        // TO TEST
    }

    class Solution {
        public int maxWidthOfVerticalArea(int[][] points) {
            //对x轴进行排序
            Arrays.sort(points, (a, b) -> a[0] - b[0]);
            int mx = 0;
            for (int i = 1; i < points.length; i++) {
                mx = Math.max(mx, points[i][0] - points[i - 1][0]);
            }

            return mx;
        }
    }
}
